export default defineNuxtConfig({
  // 禁用所有自动重定向
  // routeRules: {
  //   '/m/**': { redirect: undefined } // 清除/m/路径的重定向
  // },
  devtools: { enabled: true },
  devServer: {
    host: "0.0.0.0",
    port: 3005,
  },
  nitro: {
    devProxy: {
      "/api": {
        target: "http://127.0.0.1:8080", // 客户端代理转发
        changeOrigin: true,
      },
    },
    // routeRules: {
    //   "/api/**": {
    //     proxy: "https://www.yunshussr.com/**", // 服务端代理转发
    //   },
    // },
  },
  app: {
    head: {
      charset: "utf-8",
      viewport: "width=device-width,initial-scale=1",
      title: "素材网",
      meta: [
        {
          name: "description",
          content: "",
        },
        {
          name: "Keywords",
          content: "",
        },
      ],
      link: [{ rel: "icon", href: "/favicon.ico", type: "image/x-icon" }],
      // script: [
      //   {
      //     src: "https://webapi.amap.com/maps?v=1.4.15&key=23ba40ee4ed579864bcab5f0a42d61ce", // 替换为你的高德地图API密钥
      //     async: true,
      //     defer: true,
      //   },
      // ],
    },
    pageTransition: { name: "page", mode: "out-in" },
  },
  // router: {
  //   mode: 'hash'
  // },
  plugins: ["~/plugins/useGlobalMethods.js"],
  modules: [
    "@ant-design-vue/nuxt",
    "@unocss/nuxt",
    "@pinia/nuxt",
    "pinia-plugin-persistedstate/nuxt",
  ],
  antd: {
    // Options
    extractStyle: true, // 这个是关键参数
  },
  vite: {
    css: {
      preprocessorOptions: {
        less: {
          additionalData: '@import "@/assets/styles/index.less";',
        },
      },
      postcss: {
        plugins: [],
      },
      
    },
  },
  compatibilityDate: "2025-03-13",
});
